// 判断是否周末
export const isWeekend = (date) => {
  return [0, 6].includes(new Date(date).getDay())
}

// 获取年份
export const getDateYear = (date) => {
  return new Date(date).getFullYear()
}

// 获取月份
export const getDateMonth = (date) => {
  return new Date(date).getMonth() + 1
}

// 获取月份天数
export const getMonthDay = (date) => {
  let year = new Date(date).getFullYear()
  let month = new Date(date).getMonth() + 1
  return new Date(year, month, 0).getDate()
}

// 获取月份第一天是周几
export const getMonthFirstDayOrder = (date) => {
  let year = new Date(date).getFullYear()
  let month = new Date(date).getMonth()
  return new Date(year, month, 1).getDay()
}

// 获取上个月有多少天
export const getPrevMonthDay = (date) => {
  let year = new Date(date).getFullYear()
  let month = new Date(date).getMonth()
  if (month === 0) {
    year--
    month = 12
  }
  return new Date(year, month, 0).getDate()
}